@(passwordChangeForm:Form[securesocial.controllers.ChangeInfo])(implicit request: RequestHeader, messages: Messages, env: securesocial.core.RuntimeEnvironment, configuration: play.api.Configuration)
@import securesocial.core.IdentityProvider
@import helper._
@implicitFieldConstructor = @{ FieldConstructor(securesocial.views.html.inputFieldConstructor.f) }

@securesocial.views.html.main( Messages("securesocial.passwordChange.title") ) {
    <div class="page-header">
        <h1>@Messages("securesocial.passwordChange.title")</h1>
    </div>

    @request.flash.get("error").map { msg =>
        <div class="alert alert-error">
            @msg
        </div>
    }

    @if( request.flash.get("success").isDefined ) {
        <div class="alert alert-info">
            @request.flash.get("success").get
        </div>

        <div class="form-actions">
            <a class="btn" href="@securesocial.controllers.ProviderControllerHelper.landingUrl(configuration)">@Messages("securesocial.passwordChange.okButton")</a>
        </div>
    } else {
        <form action="@env.routes.passwordChangeUrl"
              class="form-horizontal"
              autocomplete= "off"
              method="POST"
        >
            <fieldset>
                @CSRF.formField
                @helper.inputPassword(
                    passwordChangeForm("currentPassword"),
                    '_label -> Messages("securesocial.passwordChange.currentPassword"),
                    'class -> "input-xlarge"
                )

                @helper.inputPassword(
                    passwordChangeForm("newPassword.password1"),
                    '_label -> Messages("securesocial.passwordChange.newPassword1"),
                    'class -> "input-xlarge"
                )

                @helper.inputPassword(
                    passwordChangeForm("newPassword.password2"),
                    '_label -> Messages("securesocial.passwordChange.newPassword2"),
                    '_error -> passwordChangeForm.error("newPassword"),
                    'class -> "input-xlarge"
                )

                <div class="form-actions">
                    <button type="submit" class="btn btn-primary">@Messages("securesocial.passwordChange.changeButton")</button>
                    <a class="btn" href="@securesocial.controllers.ProviderControllerHelper.landingUrl(configuration)">@Messages("securesocial.signup.cancel")</a>
                </div>
            </fieldset>
        </form>
     }
}